const set_localToken = data => {
  try {
    localStorage.setItem("localToken", JSON.stringify(data));
  } catch {
    console.log("error set_localStorage!!");
  }
};
const get_localToken = () => {
  try {
    let data = localStorage.getItem("localToken");
    return JSON.parse(data);
  } catch {
    console.log("error get_localToken!!");
  }
};

const delect_localToken = () => {
  try {
    localStorage.removeItem("localToken");
  } catch {
    console.log("error delect_localToken!!");
  }
};

const set_localUserInfo = data => {
  try {
    localStorage.setItem("localUserInfo", JSON.stringify(data));
  } catch {
    console.log("error set_localUserInfo!!");
  }
};
const get_localUserInfo = () => {
  try {
    let data = localStorage.getItem("localUserInfo");
    return JSON.parse(data);
  } catch {
    console.log("error get_localUserInfo!!");
  }
};

const delect_localUserInfo = () => {
  try {
    localStorage.removeItem("localUserInfo");
  } catch {
    console.log("error delect_localUserInfo!!");
  }
};

module.exports = {
  set_localToken,
  get_localToken,
  delect_localToken,
  set_localUserInfo,
  get_localUserInfo,
  delect_localUserInfo
};
